package com.itheima.controller;

import com.itheima.domain.Login;
import com.itheima.domain.Stu;
import com.itheima.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {

    // TODO 测试实体类User参数传递，传递json格式数据
    @RequestMapping("/save")
    @ResponseBody
    public String save(@RequestBody User user) {
        System.out.println("传递的实体类参数数据为 ==> "+user);
        return "{'module':'pojo param'}";
    }

    // TODO 测试查询id参数传递，传递json格式数据
    @RequestMapping("/getById")
    @ResponseBody
    public String getById(@RequestBody Stu stu) {
        System.out.println("要查询的id为 ==> "+stu.getId());
        return "{'module':'common param'}";
    }
    // TODO 测试查询条件参数传递，传递json格式数据
    @RequestMapping("/login")
    @ResponseBody
    public String login(@RequestBody Login login) {
        System.out.println("用户名： ==> "+login.getName());
        System.out.println("密码： ==> "+login.getPassword());
        return "{'module':'query condition param'}";
    }
}











